import re

text = '11112312341234123k'
regex = re.compile(r'\d*')
result = regex.sub('a',text)
print(result)
# match 匹配开头 = search(r'^\d*')
result = regex.match(text)
if result:
    print(result.group())

# fullmatch 全文匹配 = search(r'^\d*$')
result = regex.fullmatch(text)
if result:
    print(result.group())

result = regex.sub('a',text)
print(result)